<%--
  Created by IntelliJ IDEA.
  User: M1523
  Date: 2025/3/21
  Time: 15:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>注册页面</title>
    <style>
        body {
            font-family: '楷体', 'KaiTi', sans-serif; /* 修改字体为楷体 */
            background-color: #f4f4f4;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            background-image: url("${pageContext.request.contextPath}/images/981.jpg");
            background-size: cover;
            background-position: center;
        }
        .register-container {
            background-color: rgba(255, 255, 255, 0.9); /* 半透明背景 */
            padding: 30px;
            border-radius: 10px;
            box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
            width: 300px;
            text-align: center;
        }
        .register-container h2 {
            margin-bottom: 20px;
            color: #333;
        }
        .register-container input[type="text"],
        .register-container input[type="password"],
        .register-container input[type="email"] {
            width: calc(100% - 22px);
            padding: 10px 10px;
            margin: 10px 0;
            border: none; /* 去掉所有边框 */
            border-bottom: 1px solid #ccc; /* 只显示底边 */
            background-color: transparent; /* 透明背景 */
            backdrop-filter: blur(5px); /* 模糊效果 */
            transition: border-color 0.3s, font-size 0.3s, transform 0.3s;
            font-size: 16px;
        }
        .register-container input[type="text"]:focus,
        .register-container input[type="password"]:focus,
        .register-container input[type="email"]:focus {
            border-color: #28a745;
            outline: none;
        }
        .register-container input[type="text"]::placeholder,
        .register-container input[type="password"]::placeholder,
        .register-container input[type="email"]::placeholder {
            color: #999;
        }
        .register-container input[type="submit"] {
            width: 100%;
            padding: 10px;
            background-color: #28a745;
            border: none;
            border-radius: 5px;
            color: white;
            font-size: 16px;
            cursor: pointer;
            transition: background-color 0.3s;
        }
        .register-container input[type="submit"]:hover {
            background-color: #218838;
        }
        .register-container input[type="submit"]:active {
            background-color: #1e7e34;
        }
        .icon {
            position: absolute;
            left: 10px;
            top: 50%;
            transform: translateY(-50%);
            color: #999;
        }
        .input-with-icon {
            position: relative;
        }
        .input-with-icon input {
            padding-left: 30px;
        }
        .input-with-icon:hover input {
            font-size: 14px; /* 字体变小 */
            transform: translateY(-5px); /* 向上滑动 */
        }
    /*    ================================*/
        .registration-container {
            max-width: 600px;
            margin: 2rem auto;
            padding: 2rem;
            border-radius: 10px;
            box-shadow: 0 0 15px rgba(0,0,0,0.1);
            background-color: #ffffff;
        }
        .form-icon {
            color: #6c757d;
            font-size: 1.2rem;
        }
        .avatar-preview {
            width: 100px;
            height: 100px;
            border-radius: 50%;
            object-fit: cover;
            border: 2px solid #dee2e6;
            margin-bottom: 1rem;
        }
        .form-control:focus {
            border-color: #80bdff;
            box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.25);
        }
        .btn-submit {
            background-color: #0d6efd;
            color: white;
            transition: all 0.3s ease;
        }
        .btn-submit:hover {
            background-color: #0b5ed7;
        }
    </style>
</head>
<body>
<div class="register-container">
    <h2>注册</h2>
    <form action="${pageContext.request.contextPath}/zcUserqt" method="post" enctype="multipart/form-data">
        <div class="input-with-icon">
            <i class="fas fa-user icon"></i>
            <input type="text" name="user_name" placeholder="用户名" required class="sr">
        </div>
        <div class="input-with-icon">
            <i class="fas fa-lock icon"></i>
            <input type="password" name="user_pass" placeholder="密码" required class="sr">
        </div>
        <div class="input-with-icon">
            <i class="fas fa-lock icon"></i>
            <input type="password" name="user_phone" placeholder="手机号" required class="sr">
        </div>
        <!-- 头像上传 -->
        <div class="mb-3">
            <div class="d-flex align-items-center">
                <img src="default-avatar.jpg" alt="头像预览" class="avatar-preview me-3" id="avatarPreview">
                <input type="file" class="form-control" name="image" accept="image/*" onchange="previewImage(event)">
            </div>
        </div>
        <input type="submit" value="注册">
    </form>
</div>

<!-- 引入Bootstrap JS -->
<script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.3.0/js/bootstrap.bundle.min.js"></script>
<script>
    function previewImage(event) {
        const reader = new FileReader();
        reader.onload = function(){
            const preview = document.getElementById('avatarPreview');
            preview.src = reader.result;
        };
        reader.readAsDataURL(event.target.files[0]);
    }
</script>
</body>
</html>
